package com.meisupic.copyright.domain.po;

import static javax.persistence.EnumType.STRING;

import com.meisupic.copyright.common.MonitorStatusEnum;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.UpdateTimestamp;

/**
 * @Author lanjian
 * @Date 2018/3/14 上午10:17
 */

@Data
@Entity
@Table(name = "copyright_monitor_record")
@DynamicUpdate
public class MonitorRecord {

  @Id
  @GeneratedValue
  private Long id;

  @Column(name = "works_id", length = 20)
  private Long worksId;

  @Column(name = "works_name", length = 200, nullable = false)
  private String worksName;

  @Column(name = "works_type", length = 20, nullable = false)
  private String worksType;

  @Column(name = "works_img_url", length = 200, nullable = false)
  private String workImgUrl;

  @Column(name = "status", length = 20, nullable = false, columnDefinition = "enum('running','stopped') DEFAULT 'running' ")
  @Enumerated(value = STRING)
  private MonitorStatusEnum status;

  @Column(name = "version", length = 3, nullable = false)
  @Version
  private Integer version;

  @Column(name = "user_id", length = 20, nullable = false)
  private Long userId;

  @Column(name = "user_name", length = 50, nullable = false)
  private String userName;

  @Column(name = "create_time", nullable = false)
  @CreationTimestamp()
  private Date createTime;

  @Column(name = "modify_time", nullable = false)
  @UpdateTimestamp
  private Date modifyTime;

}
